home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 19 / CU Amiga Magazine's Super CD-ROM 19 (1998)(EMAP Images)(GB)[!][issue 1998-02].iso / CUCD / Utilities / MyAmigaAppicon / arexx / MyAmigaAppIcon.dopus5
Text File  |  1997-07-21  |  8KB  |  207 lines

  1. /*
  2.   $VER: MyAmigaAppIcon.dopus5 0.500 (21 Jul 1997)
  3.   Written by Dominique Dutoit (eightyfour@hotmail.com).
  4.  
  5.   ARexx script for Directory Opus 5.5 to create an AppIcon named "My Amiga".
  6.  
  7.   And then your Amiga is smarter! Why? This script is based on a feature
  8.   from the MacOS : when you drop an extension, a control panel, or a font
  9.   on the System Folder, the Mac asks you if you want to put the dropped
  10.   file in the appropriated folder.
  11.  
  12.   This script emulates this feature by using DOpus filetypes, and you
  13.   can customize it at wish (which is not the case with MacOS, and you can
  14.   still wait Windoze 2000 to get something like that).
  15.  
  16.   The magic mode - is a way to disable the confirmation requester. Imagine
  17.   you drop a library and a device on the appicon : the library will be copied
  18.   to LIBS: and the device to DEVS: without asking anything to you. Note that
  19.   the version checking of DOpus is activated, so if the dropped file is
  20.   a different version that the previous one, you will be asked to confirm.
  21.  
  22.   This script is a prototype, and you must be careful. I can't be responsible
  23.   of any damage caused to your Amiga. Use it at your own risks. Read
  24.   "MyAmigaAppIcon.readme" on how to install the package.
  25.  
  26.   Send your bug reports and suggestions to eightyfour@hotmail.com.
  27.  
  28.   Function : ARexx      DOpus5:ARexx/MyAmigaAppIcon.dopus5 {Qp} {Qs}
  29. */
  30.  
  31. options results
  32.  
  33. parse arg portname screenname .
  34. if portname='' then
  35.    portname='DOPUS.1'
  36. address value portname
  37. if screenname~='' & screenname~='SCREEN' then
  38.    screenname='PUBSCREEN' screenname
  39.  
  40. lf='0a'x
  41.  
  42. if ~show('l','rexxsupport.library') then
  43.    call addlib('rexxsupport.library',0,-30)
  44.  
  45. handlername='MyAmigaAppIcon.'portname
  46. if show('p',handlername) then do
  47.    dopus request '"My Amiga AppIcon'lf'is already running!" OK'
  48.    exit
  49.    end
  50. call openport(handlername)
  51.  
  52. iconmenu.COUNT = 3
  53. iconmenu.0 = 'libs:'
  54. iconmenu.1 = 'devs:'
  55. iconmenu.2 = 'classes:'
  56. dispreq = TRUE
  57.  
  58. dopus addappicon handlername '"My Amiga" 1' icon 'DOpus5:Icons/MyAmiga' close local info quotes menu iconmenu
  59. myicon=result
  60.  
  61. do until event='close' | event='removed'
  62.    if waitpkt(handlername) then do
  63.  
  64.       packet=getpkt(handlername)
  65.       if packet~='00000000'x then do
  66.  
  67.          event=getarg(packet,0)
  68.          id=getarg(packet,1)
  69.          namestr=getarg(packet,2)
  70.          handle=getarg(packet,3)
  71.  
  72.          select
  73.             when event='dropfrom' then do
  74.                dopus setappicon myicon busy on
  75.                lister set handle busy on
  76.                do while namestr~==''
  77.                   parse var namestr '"' thisfile '"' namestr
  78.                   if handle>0 then do
  79.                      lister query handle path
  80.                      nameoffile=thisfile
  81.                      thisfile=result||thisfile
  82.                      end
  83.                      dopus getfiletype '"'thisfile'"' 'id'
  84.  
  85.                      filetype = STRIP(RESULT,"B",'"')
  86.                      fileis = ''
  87.  
  88.                      IF filetype ~='' then do
  89.                          select
  90.                             when filetype = 'LIBRARY' then do
  91.                                 fileis = 'a library'
  92.                                 copyto = 'LIBS:'
  93.                             end
  94.                             when filetype = 'DEVICE' then do
  95.                                 fileis = 'a device'
  96.                                 copyto = 'DEVS:'
  97.                             end
  98.                             when filetype = 'DT' then do
  99.                                 fileis = 'a datatype'
  100.                                 copyto = 'SYS:classes/datatypes/'
  101.                             end
  102.                             when filetype = 'DTDESC' then do
  103.                                 fileis = 'a datatype descriptor'
  104.                                 copyto = 'DEVS:datatypes/'
  105.                             end
  106.                             when filetype = 'BCLASS' then do
  107.                                 fileis = 'a BOOPSI class'
  108.                                 copyto = 'SYS:classes/'
  109.                             end
  110.                             when filetype = 'BGADGET' then do
  111.                                 fileis = 'a BOOPSI gadget'
  112.                                 copyto = 'SYS:classes/gadgets/'
  113.                             end
  114.                             when filetype = 'BIMAGE' then do
  115.                                 fileis = 'a BOOPSI image'
  116.                                 copyto = 'SYS:classes/image/'
  117.                             end
  118.                             when filetype = 'MUI' then do
  119.                                 fileis = 'a MUI file'
  120.                                 copyto = 'MUI:libs/mui/'
  121.                             end
  122.                             when filetype = 'MCP' then do
  123.                                 fileis = 'a MCP file'
  124.                                 copyto = 'MUI:libs/mui/'
  125.                             end
  126.                             when filetype = 'MCC' then do
  127.                                 fileis = 'a MCC file'
  128.                                 copyto = 'MUI:libs/mui/'
  129.                             end
  130.                             when filetype = 'MLIB' then do
  131.                                 fileis = 'a MUI library'
  132.                                 copyto = 'MUI:libs/mui/'
  133.                             end
  134.                             when filetype = 'MCLASS' then do
  135.                                 fileis = 'a MUI class'
  136.                                 copyto = 'MUI:libs/mui/'
  137.                             end
  138.                             when filetype = 'DOPUS5' then do
  139.                                 fileis = 'a DOpus 5 script'
  140.                                 copyto = 'DOPUS5:ARexx/'
  141.                             end
  142.                             when filetype = 'PPRX' then do
  143.                                 fileis = 'a PPaint script'
  144.                                 copyto = 'PPaint:Rexx/'
  145.                             end
  146.                             when filetype = 'PPLIB' then do
  147.                                 fileis = 'a PPaint library'
  148.                                 copyto = 'PPaint:libs/'
  149.                             end
  150.                             otherwise fileis = ''
  151.                          end
  152.                      end
  153.  
  154.                      if ( fileis ~= '' ) then do
  155.                         copynow = FALSE
  156.                         if dispreq = TRUE then
  157.                             do
  158.                                 dopus request '"'nameoffile' is 'fileis'.'lf'Do you want to copy it to 'copyto' ?" Yes|No'
  159.                                 if rc = 1 then copynow = TRUE
  160.                             end
  161.                         else
  162.                             copynow = TRUE
  163.  
  164.                         if copynow = TRUE then command wait copy NAME '"'thisfile'"' TO '"'copyto'"'
  165.                      end
  166.                   end
  167.                   lister set handle busy off
  168.                   dopus setappicon myicon busy off
  169.                 end
  170.             when event='doubleclick' then do
  171.                     if dispreq = TRUE then
  172.                         do
  173.                             dispreq = FALSE
  174.                             dopus setappicon myicon text '"My Amiga (Magic)"'
  175.                         end
  176.                     else
  177.                         do
  178.                             dispreq = TRUE
  179.                             dopus setappicon myicon text '"My Amiga"'
  180.                         end
  181.                 end
  182.             when event='info' then
  183.                 do
  184.                     dopus request '"My Amiga AppIcon'lf'Drop files on it to copy them.'lf'Click twice to (des)activate the magic mode." OK|Magic mode ?'
  185.                     if RC = 0 then dopus request '"When the magic mode is enabled,'lf'your Amiga doesn''t ask you where'lf'to copy the dropped files." OK'
  186.                 end
  187.             when event='menu' then
  188.                 do
  189.                     select
  190.                         when namestr = '0' then command scandir new 'libs:'
  191.                         when namestr = '1' then command scandir new 'devs:'
  192.                         when namestr = '2' then command scandir new 'sys:classes/'
  193.                         otherwise nop
  194.                     end
  195.                 end
  196.             otherwise
  197.                nop
  198.             end
  199.  
  200.          call reply(packet,0)
  201.          end
  202.       end
  203.    end
  204.  
  205. dopus remappicon myicon
  206. call closeport(handlername)
  207.